package com.hongyuan.sellfitness.ui.person.view_mode;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;
import com.hongyuan.mvvmhabitx.binding.command.BindingAction;
import com.hongyuan.mvvmhabitx.binding.command.BindingCommand;
import com.hongyuan.sellfitness.base.ItemViewModel;
import com.hongyuan.sellfitness.ui.person.beans.MyGroupBean;

public class MyGroupItemViewModel extends ItemViewModel<MyGroupViewModel> {

    public ObservableField<MyGroupBean.ListBean> entity = new ObservableField<>();

    public MyGroupItemViewModel(@NonNull MyGroupViewModel viewModel, MyGroupBean.ListBean bean) {
        super(viewModel);
        entity.set(bean);
    }

    //条目的点击事件
    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            viewModel.itemClick(MyGroupItemViewModel.this);

            if(entity.get().getOperateType() == 1){
                //团课签到
                viewModel.uc.goScan.call();
            }else if(entity.get().getOperateType() == 2){
                //取消团课报名
                viewModel.uc.cancel.call();
            }
        }
    });

}
